<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<title>模型列表</title>
		<link rel="icon" href="favicon.ico" type="image/x-icon" />
		<jsp:include page="../include.jsp" />
	</head>
	<body class="list">
		<div class="bar">模型列表&nbsp;总记录数: ${fn:length(models)}
			<input type="button" id="addButton" class="formButton" value="添加"
				hidefocus style="float: right; margin-right: 10px"
				onclick="window.location='add.jsp'" />
		</div>
		<div class="body">
			<div id="table">
				<form id="listForm" action="model.do" method="post">
					<table id="listTable" class="listTable">
						<tr>
							<th class="check"><input type="checkbox" class="allCheck" /></th>
							<th><a href="#" class="sort" name="model_name" hidefocus>模型名称</a></th>
							<th><a href="#" class="sort" name="tpl_channel_prefix" hidefocus>栏目模板前缀</a></th>
							<th><a href="#" class="sort" name="tpl_content_prefix" hidefocus>内容模板前缀</a></th>
							<th><a href="#" class="sort" name="priority" hidefocus>排列顺序</a></th>
							<th><a href="#" class="sort" name="is_def" hidefocus>默认</a></th>
							<th><a href="#" class="sort" name="is_disabled" hidefocus>启用</a></th>
							<th><span>操作</span></th>
						</tr>
						<c:forEach items="${models}" var="model">
							<tr>
								<td><input type="checkbox" name="ids" value="${model.model_id}" id="id"/>
								</td>
								<td><span title="${model.model_name}">${model.model_name} </span></td>
								<td>${model.tpl_channel_prefix}</td>
								<td>${model.tpl_content_prefix}</td>
								<td><input type="text" value="${model.priority}" name="priority" size="5" id="priority"/></td>
								<td><input type="radio" id="is_def" name="is_def"<c:if test='${model.is_def}'> checked="checked"</c:if> value="${model.model_id}"/></td>
								<td><input type="checkbox" id="is_disabled" name="is_disabled"<c:if test='${!model.is_disabled}'> checked="checked"</c:if> value="${model.model_id}"/></td>
								<td>
									<a href="edit.do?id=${model.model_id}" title="修改">[修改]</a>
									<a href="modelChannel.do?model_id=${model.model_id}&model_type=1" title="栏目模型">[栏目模型]</a>
									<a href="modelChannel.do?model_id=${model.model_id}&model_type=2" title="内容模型">[内容模型]</a>
								</td>
							</tr>
						</c:forEach>
					</table>
					<c:choose>
						<c:when test="${fn:length(models)==0}">
							<div class="noRecord">没有找到任何记录!</div>
						</c:when>
						<c:otherwise>
							<div class="delete" style="padding-left: 10px"><input
								type="button" id="deleteButton" class="formButton" url="delete.do"
								value="删除" disabled hidefocus />
							<input
								type="button" id="saveButton" class="formButton" url="save.do"
								value="保存" hidefocus/>
							</div>
						</c:otherwise>
					</c:choose>
				</form>
			</div>
		</div>
	</body>
</html>